<template>
  <view-box style="background:#F3F6F7">
    <div class="address-search">
      <router-link to="/jobsearch" class="search-div">
        <i class="search-icon iconfont icon-sousuo" style="font-size: 20px;"></i>
        <p class="search-String">天南山</p>
      </router-link>
    </div>
    <div style="height:55px;"></div>
    <div >
    <div style="height:20px;"></div>
    <div class="co-laou" v-for="(item, index) in items" :key="index" @click="$router.push('/previewLouw?id=' + item.user_id)" v-if="item.basic !== null">
        <div class="co-lib">
            <div class="co-dilkp">
                <p style="font-size:15px;color:#000;font-weight: 600;" v-if="item.basic === null">未知职位</p>
                <p style="font-size:15px;color:#000;font-weight: 600;" v-if="item.basic !== null">{{item.basic.company}}</p>
                <p style="font-size:13px;color:#BABABA;">{{item.basic.city}} | {{birth - item.basic.start_work_time}}年 | {{item.work_number_count}}段工作经验</p>
            </div>
            <div class="co-dilk">
                <p style="font-size:15px;color:#32B6C6;font-weight: 600;" v-if="item.basic !== null && item.basic.is_look_annual_salary === 1">{{item.basic.annual_salary}}</p>
                <p style="font-size:15px;color:#32B6C6;font-weight: 600;" v-if="item.basic !== null && item.basic.is_look_annual_salary === 0">保密</p>
                <p style="font-size:13px;color:#BABABA;">{{item.created_at | formatDate}}</p>
            </div>
        </div>
        <div class="co-bott-om">
           <div class="work-job-lj">
                <p style="color: #ff0000;font-weight: 600;width:100%;"><img style="width:66px;height:66px;" :src="item.user.avatar" alt=""></p>
            </div>
            <div class="work-job-cl" >
                <p class="job-pol-col" style="font-size:13px;color:#000;font-weight: 0;">{{item.basic.true_name}}</p>
                <p class="job-pol-col" style="font-size:13px;color:#BABABA;font-weight: 0;">{{item.basic.now_status}}</p>
            </div>
        </div>
     </div>
       <infinite-loading @infinite="infiniteHandler" ref="infiniteLoading">
            <load-more slot="no-more" :show-loading="false" tip="到底了" background-color="#fbf9fe"></load-more>
            <empty slot="no-results" tips="暂时没有相关内容"></empty>
       </infinite-loading>
    </div>
  </view-box>
</template>
<script>
import { ViewBox, Box, Flexbox, FlexboxItem, XSwitch } from 'vux'
import { formatDate } from '../../utils/index.js'
export default {
  components: {
    ViewBox,
    Box,
    Flexbox,
    FlexboxItem,
    XSwitch
  },
  data () {
    return {
      show1: false,
      items: []
    }
  },
  computed: {
    birth: function () {
      let mydate = new Date()
      let newdate = mydate.getFullYear()
      console.log(newdate)
      return newdate
    }
  },
  filters: {
    formatDate (time) {
      var date = new Date(time)
      return formatDate(date, 'yyyy-MM-dd')
    }
  },
  methods: {
    // _gettalentsRecommend () {
    //   this.$http.get('/talentsRecommend').then(response => {
    //     this.items = response.data
    //     console.log(this.items)
    //   }).catch(error => {
    //     console.log(error)
    //   })
    // },
    infiniteHandler ($state) {
      this.$http.get('/talentsRecommend', {
        params: {
          position: this.$route.query.keywords,
          page: this.items.length / 5 + 1,
          page_size: 5
        }
      }).then((response) => {
        if (response.data.data.length) {
          this.items = this.items.concat(response.data.data)
          console.log(this.items)
          $state.loaded()
          if (!response.data.next_page_url) {
            $state.complete()
          }
        } else {
          $state.complete()
        }
      })
    }
  }
}
</script>
<style scoped>
 .address-search {
    height: 50px;
    width: 100%;
    font-size: 16px;
    position: fixed;
    z-index: 999;
    top: 0;
    display: flex;
    background-color: #fff;
  }
  .address-div {
    width: 25%;
    padding-left: 5px;
    height: 50px;
    line-height: 50px;
    display: flex;
    -webkit-box-pack: center;
    justify-content: center;
  }
  .address-icon {
    color: #595959;
    margin-left: 6px;
    padding-right: 6px;
  }
  .address-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #878787;
  }
  .xaddress {
    display: none;
  }
  .search-div {
    width: 94%;
    line-height: 30px;
    display: flex;
    height: 30px;
    margin-top: 10px;
    margin-left: 3%;
    background-color: #f2f2f2;
    border-radius: 20px;
  }
  .search-icon {
    color: #8e8e8e;
    margin-left: 5%;
    font-size: 20px;
  }
  .search-String {
    color: #bebebe;
    margin-left: 5%;
    font-size: 15px;
  }
  .main{
    width: 94.4%;
    margin: 0 auto;
  }
.background-clo{
  height: 104px;
  width: 100%;
}
.talent-clo{
    width: 100%;
    border-bottom: #e5e5e5 1px solid;
    height: 82.8px;
    line-height: 100.4px;
    display: flex;
    display:-webkit-flex;
  }
  .talent-clo span{
    font-size: 15px;
    width: 50%;
  }
  .recommended{
    text-align: left;
    height: 83.52px;
    margin-left: 21.6px;
    font-size: 21.6px !important;
    font-weight: 600;
  }
  .batch-in-a{
    text-align: right;
    height: 83.52px;
    margin-right: 21.6px;
    font-size: 12px !important;
    color: #999999;
  }
  .head-por{
    width: 94%;
    height: 322.56px;
    border-radius: 7.2px;
    position: relative;
    box-shadow: 1px 1px 1px 1px #dedede;
    margin-top: 14.4px;
  }
  .head-popule{
    width: 94%;
    height: auto;
    position: relative;
    margin-top: 14.4px;
  }
  .head-popule .nameDesig{
    width: 100%;
    height: 86.4px;
    position:initial;
    border-bottom-left-radius: 7.2px;
    border-bottom-right-radius: 7.2px;
    text-align: center;
  }
  .head-popule .nameDesig p{
    color: #000;
  }
  .head-por img{
    width: 100%;
    height:260px;
    border-top-left-radius: 7.2px;
    border-top-right-radius: 7.2px;
  }
  .head-popule img{
    width: 100%;
    height:100%;
    border-radius: 100%;
  }
  .nameDesig{
    width: 100%;
    height: 86.4px;
    position:absolute;
    bottom:0;
    border-bottom-left-radius: 7.2px;
    border-bottom-right-radius: 7.2px;
    text-align: center;
  }
  .icon-ion-cl{
    width: 100%;
    text-align: right;
    line-height: 51.84px;
    position: absolute;
    top: 0px;
    right: 0px;
  }
  .icon-ion-cl i{
    font-size: 39.6px;
    color: #4ebbd8;
    background: #fff;
    border-radius: 50%;
    position: relative;

  }
  .nameDesig p{
    font-size:18px;
    color: #fff;
    font-weight: 500;
  }
  .rwmai-cl{
    display: flex;
    width: 100%;
    border-bottom: 1px solid #e5e5e5;
  }
  .head-col-img{
    width: 20%;
  }
  .head-col-img img{
    width: 60px;
    height: 60px;
    border-radius: 100%;
  }
  .character-hed{
    width: 100%;
  }
  .character-hed p{
    font-size: 15px;
  }
  .character-cl{
    width: 30%;
  }
  .character-cl p{
    font-size: 15px;
  }
.co-laou{
width: 92%;
margin-left: 4%;
background: #fff;
opacity: 0.8;
height: auto;
margin-top: 10px;
border-radius: 7px;
}
.co-lib{
    display: flex;
    width: 92%;
    margin-left: 4%;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-top: 20px;
    padding-bottom: 10px;
}
.co-dilkp{
    width: 60%;
  }
.co-dilk{
    width: 40%;
    text-align: right;
}
.co-bott-om{
  display: flex;
  width: 92%;
  margin-left: 4%;
  padding-top: 5px;
  padding-bottom: 5px;
}
.work-job-lj {
    width: 25%;
    display: flex;
    align-items: center;
}
.work-job-lj p{
    font-size: 15px;

}
.work-job-cl{
  width: 75%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.job-pol-col{
  width: 100%;
  font-weight: 600;
}
.work-job-cl p{
  text-align: left;
  font-size: 15px;
}
</style>
<style>


</style>